<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<body>
<canvas id="mycanvas" width="512" height="512"></canvas>
<script>
function runTest() {
    var canvas = document.getElementById('mycanvas');
    var ctx = canvas.getContext('2d');
    ctx.fillStyle = "rgb(255,165,0)";
    ctx.fillRect(0, 0, 512, 512);
    ctx.save();
    canvas.width = 256;
    ctx.fillStyle = "rgb(255,165,0)";
    ctx.fillRect(0, 0, 256, 512);
}

async_test(t => {
        window.onload = function() {
            t.step(runTest);
            t.done();
        }
}, 'Verify that canvas resize after save does not crash.');
</script>
</body>
